package com.kun.valiant.web.controller.valiant.clue;

import com.kun.valiant.common.core.domain.AjaxResult;
import com.kun.valiant.follow.service.IFollowRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 *  前端控制器
 * @author fangkun
 * @since 2023-06-08
 */
@RestController
@RequestMapping("/valiant/follow/record")
public class FollowRecordController {

    @Autowired
    IFollowRecordService followRecordService;

    /**
     * 跟进记录
     * @param clueId
     * @return
     */
    @GetMapping("/clue/{clueId}")
    @PreAuthorize("hasAnyPermissions('valiant:clue:view','valiant:clue:follow')")
    public AjaxResult getFollowRecordByClueId(@PathVariable Long clueId){
        return followRecordService.getFollowRecordByClueId(clueId);
    }

    /**
     * 跟进记录
     * @param businessId
     * @return
     */
    @GetMapping("/business/{businessId}")
    @PreAuthorize("hasAnyPermissions('valiant:business:view','valiant:business:follow')")
    public AjaxResult getBusinessRecordById(@PathVariable Long businessId){
        return followRecordService.getBusinessRecordById(businessId);
    }

}
